package com.pet.server.po;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * PetInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "pet_info")
public class PetInfo implements java.io.Serializable {

	// Fields

	private Integer petId;
	private Integer userId;
	private String petName;
	private String petCate;
	private String sex;
	private Date birthday;
	private String breed;
	private String icoPath;
	private Date createTime;
	private String description;
	private String nickName;
	private String state;

	// Constructors

	/** default constructor */
	public PetInfo() {
	}

	/** minimal constructor */
	public PetInfo(Integer userId, String petName, String petCate, String sex,
			Date birthday, String breed, Date createTime) {
		this.userId = userId;
		this.petName = petName;
		this.petCate = petCate;
		this.sex = sex;
		this.birthday = birthday;
		this.breed = breed;
		this.createTime = createTime;
	}

	/** full constructor */
	public PetInfo(Integer userId, String petName, String petCate, String sex,
			Timestamp birthday, String breed, String icoPath,
			Timestamp createTime, String description) {
		this.userId = userId;
		this.petName = petName;
		this.petCate = petCate;
		this.sex = sex;
		this.birthday = birthday;
		this.breed = breed;
		this.icoPath = icoPath;
		this.createTime = createTime;
		this.description = description;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "pet_id", unique = true, nullable = false)
	public Integer getPetId() {
		return this.petId;
	}

	public void setPetId(Integer petId) {
		this.petId = petId;
	}

	@Column(name = "user_id", nullable = false)
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@Column(name = "pet_name", nullable = false, length = 32)
	public String getPetName() {
		return this.petName;
	}

	public void setPetName(String petName) {
		this.petName = petName;
	}

	@Column(name = "pet_cate", nullable = false, length = 20)
	public String getPetCate() {
		return this.petCate;
	}

	public void setPetCate(String petCate) {
		this.petCate = petCate;
	}

	@Column(name = "sex", nullable = false, length = 8)
	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	@Column(name = "birthday", nullable = false, length = 0)
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Timestamp birthday) {
		this.birthday = birthday;
	}

	@Column(name = "breed", nullable = false, length = 20)
	public String getBreed() {
		return this.breed;
	}

	public void setBreed(String breed) {
		this.breed = breed;
	}

	@Column(name = "ico_path", length = 128)
	public String getIcoPath() {
		return this.icoPath;
	}

	public void setIcoPath(String icoPath) {
		this.icoPath = icoPath;
	}

	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "description", length = 256)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	
	@Formula("(SELECT f.nick_name FROM user_info f WHERE f.user_id=user_id)")
	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	
	@Column(name = "state", length = 128)
	public String getState() {
		return state;
	}

	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}
	
	

}